package com.zstu.mall.service;

import com.zstu.mall.common.BaseService;
import com.zstu.mall.entity.Order;
import com.zstu.mall.dao.OrderDao;
import com.zstu.mall.entity.UserOrder;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author     : wuyc
 * @description: OrderService
 * @date       : Created in 2019/11/24
 */
public interface OrderService extends BaseService<Order, String, OrderDao>  {

    /**
     * 订单状态 0:未确认1:未付款 2:商家处理中（待发货） 3:等待收货 4:订单完成
     */
    String STATUS_NO_CONFIRM = "0";
    String STATUS_NO_PAY = "1";
    String STATUS_WAITE_SEND = "2";
    String STATUS_WAIT_RECEIVE = "3";
    String STATUS_COMPLETE = "4";

    /**
     * 查询订单的订单项
     *
     * @param orderId
     * @return
     */
    List<UserOrder> findItems(String orderId);

    /**
     * 更改订单状态
     *
     * @param id
     * @param status
     */
    void updateStatus(String id, String status);

    /**
     * 查找用户的订单列表
     *
     * @param request
     * @return
     */
    List<Order> findUserOrder(HttpServletRequest request);

    /**
     * 支付
     * @param id
     * @param name
     * @param payPassword
     */
    void pay(String id, String name, String payPassword);

    /**
     * 提交订单
     * @param ids
     * @param request
     * @param response
     */
    void submit(List<String> ids, HttpServletRequest request, HttpServletResponse response) throws Exception;

    /**
     * 确认订单
     * @param id
     * @param name
     * @param phone
     * @param addr
     * @param request
     * @param response
     */
    void confirm(String id, String name, String phone, String addr, HttpServletRequest request, HttpServletResponse response) throws Exception;

    /**
     * 确认收货
     * @param id
     */
    void receive(String id);

}
